<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('servers_services', function (Blueprint $table) {
            $table->ipAddress('server');
            $table->bigInteger('service')->unsigned();

            $table->foreign('server')->references('ip_address')->on('servers')
                ->onDelete('cascade')
                ->onUpdate('cascade');
            $table->foreign('service')->references('id')->on('services')
                ->onDelete('cascade')
                ->onUpdate('cascade');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        //
    }
};
